// 函数组合 调试
// NEVER SAY DIE --> never-say-die

import _ from "lodash";

const log = (v) => {
  console.log(v);
  return v;
};

const trace = _.curry((tag, v) => {
  console.log(tag, v);
  return v;
});

const join = _.curry((separator, array) => _.join(array, separator));
const split = _.curry((separator, str) => _.split(str, separator));
const map = _.curry((fn, array) => _.map(array, fn));

// const f = _.flowRight(join("-"), log, _.toLower, split(" "));
const f = _.flowRight(
  join("-"),
  trace("map 之后"),
  map(_.toLower),
  trace("split 之后"),
  split(" ")
);
console.log(f("NEVER SAY DIE"));
